import { computed, ref, reactive } from 'vue';
import { Pagination } from '@/types/global';
import type {
  TableColumnData,
  TableData,
} from '@arco-design/web-vue/es/table/interface';

const fmodel: any = {
  applicationId: 100,
  userCode: '',
  userName: '',
  email: '',
  cellphone: '',
};

export const formModel = ref(fmodel);
export const rowSelection = reactive({
  type: 'radio',
  showCheckedAll: false,
  checkStrictly: false, 
});

export const pagination: Pagination = reactive({
  current: 1,
  pageSize: 20,
});

export const columns = computed<TableColumnData[]>(() => [
  {
    title: '编号',
    dataIndex: 'userId',
    width: 80,
    ellipsis: true,
    tooltip: true,
  },
  {
    title: '用户代码',
    dataIndex: 'userCode',
    width: 100,
    ellipsis: true,
    tooltip: true,
  },
  {
    title: '用户名称',
    dataIndex: 'userName',
    width: 100,
    ellipsis: true,
    tooltip: true,
  },
  {
    title: '用户类型',
    dataIndex: 'userTypeName',
    width: 80,
    ellipsis: true,
    tooltip: true,
  },
  {
    title: '账户类型',
    dataIndex: 'accountTypeName',
    width: 80,
    ellipsis: true,
    tooltip: true,
  },
  {
    title: '手机',
    dataIndex: 'cellphone',
    width: 100,
    ellipsis: true,
    tooltip: true,
  },
  {
    title: '创建时间',
    dataIndex: 'time',
    width: 140,
    ellipsis: true,
    tooltip: true,
  },
  {
    title: '创建人',
    dataIndex: 'creatorName',
    width: 100,
    ellipsis: true,
    tooltip: true,
  },
  {
    title: '是否可用',
    dataIndex: 'enabled',
    slotName: 'enable',
    width: 80,
    ellipsis: true,
    tooltip: true,
  },
  {
    title: '操作',
    slotName: 'operations',
    width: 110,
    align: 'center',
  },
]);
